﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System
{
    /// <summary>
    /// StringExtension
    /// </summary>
    public static partial class StringExtension
    {
        /// <summary>
        /// 转换成Base64字符串
        /// </summary>
        /// <param name="this"></param>
        /// <returns></returns>
        public static string ToBase64String(this string @this)
        {
            return Convert.ToBase64String(Encoding.UTF8.GetBytes(@this));
        }
        /// <summary>
        /// Base64解码成明文
        /// </summary>
        /// <param name="this"></param>
        /// <returns></returns>
        public static string FromBase64String(this string @this)
        {
            return Encoding.UTF8.GetString(Convert.FromBase64String(@this));
        }
    }
}
